<?php

namespace app\store\model;

use think\Model;

/**
 * 文章模型
 * Class Article
 * @package app\store\model
 */
class Suggest extends Model
{
    /**
     * 获取投诉列表
     * @return \think\Paginator
     * @throws \think\exception\DbException
     */
    public function getList()
    {
        return $this->order(['addtime' => 'desc'])
            ->where('is_delete', '=', 0)
            ->paginate(15, false, [
                'query' => request()->request()
            ]);

    }

    /**
     * 软删除
     * @return false|int
     */
    public function setDelete()
    {
        return $this->save(['is_delete' => 1]);
    }



    /**
     * 获取投诉建议总数量
     * @param array $where
     * @return int|string
     */
    public static function getSuggestTotal($where = [])
    {
        $model = new static;
        !empty($where) && $model->where($where);
        return $model->where('is_delete', '=', 0)->count();
    }

}